package com.springcloud.sc.ucpv5.client.commondata.data;

import com.springcloud.sc.ucpv5.client.commondata.datachange.DataExChange;
import com.google.protobuf.Message;

/**
 * Generated from IDL struct "GroupQueryRsp".
 *
 * @author JacORB IDL compiler V 2.3-beta-2, 14-Oct-2006
 * @version generated at 2014-10-29 11:48:54
 */

public final class GroupQueryRsp extends DataExChange {
    public GroupQueryRsp() {
    }

    public int Result;
    public com.springcloud.sc.ucpv5.client.commondata.data.Group[] Rows;

    public GroupQueryRsp(int Result, com.springcloud.sc.ucpv5.client.commondata.data.Group[] Rows) {
	this.Result = Result;
	this.Rows = Rows;
    }

    /**
     * 从当前通用对象获取probuf对象
     * 
     * @return
     */
    public Message dataChangeCommonToProBufData() {
	try {
	    com.proto.uuos_sdk_pb.GroupQueryRsp.Builder builder_dst = com.proto.uuos_sdk_pb.GroupQueryRsp.newBuilder();
	    builder_dst.setResult(Result);
	    Message pbMessage = builder_dst.build();
	    return pbMessage;
	} catch (Exception e) {
	    e.printStackTrace();
	}
	return null;
    }

    /**
     * 从probuf对象获取当前对象
     * 
     * @param builder_src
     * @return
     */
    public void dataChangeProBufDataToCommon(Message builder_src) {
	try {
	    com.proto.uuos_sdk_pb.GroupQueryRsp builder_dst = (com.proto.uuos_sdk_pb.GroupQueryRsp) builder_src;

	    Result = builder_dst.getResult();
	    Rows = new com.springcloud.sc.ucpv5.client.commondata.data.Group[builder_dst.getRowsCount()];
	    
	    System.out.println(builder_dst.getRowsCount());
	    for (int i = 0; i < builder_dst.getRowsCount(); i++) {
		Rows[i] = new com.springcloud.sc.ucpv5.client.commondata.data.Group();
		Rows[i].dataChangeProBufDataToCommon(builder_dst.getRows(i));

		if(builder_dst.getRows(i).getGroupTelno().equals("4003")){
		    System.out.println(builder_dst.getRows(i).getGroupTelno() + Rows[i].GroupTelno + "  " + Rows[i].ParGrpTelno);
		}
	    }
	    
	    
	} catch (Exception e) {
	    e.printStackTrace();
	}
    }
}
